import request from "@/config/request";

// 登录API
export const repairForm = (data) => {
  return request({
    url: '/student/repair',
    method: 'POST',
    data,
  });
};

export const getStudentInfoBatch = () => {
  return request.get('/student/list');
};  



export const getLatestNotices = (params) => {
  return request({
    url: '/student/notice/latest',
    method: 'GET',
    params: {
      ...params,
      pageSize: params.pageSize || 5 // 默认获取5条
    }
  });
};


// 获取通知详情
export const getNoticeDetail = (params) => {
  return request({
    url: '/student/notice/detail',
    method: 'GET',
    params: {
      id: params.id,

    }
  });
};


export const getLatestClassNotices = (params) => {
  return request({
    url: '/student/classnotice/latest',
    method: 'GET',
    params: {
      ...params,
      pageSize: params.pageSize || 5 // 默认获取5条
    }
  });
};

export const getClassNoticeDetail = (params) => {
  return request({
    url: '/student/classnotice/detail',
    method: 'GET',
    params: {
      id: params.id,

    }
  });
};


// 获取当前学生的课程表
export const getStudentCourses = (studentId) => {
  return request({
    url: `/student/courses`,
    method: 'get',
    params: { studentId }
  });
};


export const getClassLeader = (params) => {
  return request.get('/student/leader', { params });
};  


export const getDormAdmin = (params) => {
  return request.get('/student/dorm', { params });
};  


// export const EvaluationSubmit = (params) => {
//   return request.post('/student/submit', { params });
// };  


export const EvaluationSubmit = (data) => {
  return request({
    url: '/student/submit',
    method: 'POST',
    data,
  });
};

export const getPosts = (params) => {
  return request({
    url: '/student/posts',
    method: 'GET',
    params: {
      ...params,
    }
  });
};



// export const getStudentEvaluation = (studentId) => {
//   return request({
//     url: `/student/evaluation`,
//     method: 'get',
//     params: { studentId }
//   });
// };






export const getStudentEvaluation = (params) => {
  return request({
    url: '/student/evaluation',
    method: 'GET',
    params: {
      targetId: params.targetId,
      targetType: params.targetType
    }
  });
};

export const PostSubmit = (data) => {
  return request({
    url: '/student/post',
    method: 'POST',
    data,
  });
};





export const CommentSubmit = (data) => {
  return request({
    url: '/student/comment',
    method: 'POST',
    data,
  });
};

export const ReplySubmit = (data) => {
  return request({
    url: '/student/reply',
    method: 'POST',
    data,
  });
};




export const getMyEvaluations = (params) => {
  return request({
    url: '/student/myevaluation',
    method: 'GET',
    params: {
      ...params,
    }
  });
};



